package com.whmskj.xjlhsc.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.whmskj.xjlhsc.controller.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.whmskj.xjlhbc.domain.Yg01employeefiles;
import com.whmskj.xjlhbc.service.Yg01employeefilesService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author lk
 * @since 2025-07-16 11:35:41
 */
@RestController
@RequestMapping("/api/yg01employeefiles")
@SaIgnore
public class Yg01employeefilesController {

    @Autowired
    private Yg01employeefilesService yg01employeefilesService;

    /**
     * 分页查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findPage")
    public ResponseEntity<Page<Yg01employeefiles>> findPage(@RequestBody Yg01employeefiles params) {
        Page<Yg01employeefiles> result = yg01employeefilesService.findPage(params);
        return ResponseEntity.ok(result);
    }

    /**
     * 列表查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findList")
    public Result findList(@RequestBody Yg01employeefiles params) {
        return Result.success(yg01employeefilesService.findList(params));
    }

    /**
     * 查询
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result findById(@PathVariable("id") Long id) {
        Yg01employeefiles yg01employeefiles = yg01employeefilesService.findById(id);
        return Result.success(yg01employeefiles);
    }

    /**
     * 新增
     *
     * @param yg01employeefiles
     * @return
     */
    @PostMapping
    public ResponseEntity<Boolean> insert(@RequestBody Yg01employeefiles yg01employeefiles) {
        boolean result = yg01employeefilesService.insert(yg01employeefiles);
        return ResponseEntity.ok(result);
    }

    /**
     * 修改
     *
     * @param yg01employeefiles
     * @return
     */
    @PutMapping
    public ResponseEntity<Boolean> update(@RequestBody Yg01employeefiles yg01employeefiles) {
        boolean result = yg01employeefilesService.update(yg01employeefiles);
        return ResponseEntity.ok(result);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public ResponseEntity<Integer> delete(@PathVariable("id") Long id) {
        int result = yg01employeefilesService.delete(id);
        return ResponseEntity.ok(result);
    }

}